package com.see51.sdk.java;

import com.ic70.kkplayer.sdk.CJniKKPlayer;
import com.sinaapp.bashell.VoAACEncoder;

/**
 * Created by saint on 2016/2/26.
 */
public class Jni51SeeSdk {

    static{
        System.loadLibrary("z");
        System.loadLibrary("KKPlayerCore");
        System.loadLibrary("see51sdk");
    }

    public static  void IniSdk()
    {
         Jni51SeeSdk sdk = new Jni51SeeSdk();
         sdk.JniIni51SeeSdk();
         CJniKKPlayer pp = new  CJniKKPlayer();
         pp.GIni();
         VoAACEncoder acc = new  VoAACEncoder();
    }
    public native void  JniIni51SeeSdk();
    public native int   JniUn51SeeSdk();
    //获取设备句柄，大于0表示成功
    public native int   JniGetDevHandle(String  deviceid, String serverip);
    //获取设备ID
    public native String JniGetDevId    (int Handle);
    //获取转发服务器IP
    public native String JniGetDevTurnIp(int Handle);
    //JniGetDevHandle,调用后需要调用JniReleaseDevHandle(
    public native int   JniReleaseDevHandle(int Handle);
    //设置存储目录
    public native void  JniSetFileStoreDir(String  dir);
    //获取文件目录
    public native String JniGetDevDir(int Handle);
    //获取设备信息
    public native String JniGetDevInfo(int Handle);
    //设备抓拍,返回json数据格式
    public native String JniGetSnapshotPic(int Handle);
    //发送Rtmp 请求消息
    public native String JniSendDevRtmp(int Handle,String rtmpurl, int actiontype, int stream);
    //获取设备推流状态
    public native String JniGetRtmpStatusAction(int Handle);
    //保存设备信息
    public native String JniSaveDevInfo(int Handle,String  strjson);
    //获取设备文件列表
    public native String JniGetDevFileList(int Handle, String  dir);
    //设置设备动作
   /*
    action = 15 , 镜像
             16 , 翻转
             17 , 焦距+
             18,  焦距-
             5,	  放大,聚焦
	         6 ,  缩小,聚焦
    */
    public native int  JniSetDevAction(int Handle, int action);
    //请求设备下载文件
    public native String JniGetDownDevFile(int Handle,String  path,int filesize);
    //取消设备文件下载
    public native void  JniRequstCancelDevFile(int Handle, String fileName);
    //获取文件下载进度信息
    public native String JniGetFileInfo(int Handle,String fileName);
    //0000 0001： 1 文件      0000 0010：2   断开监听   0000 0100：  4 音频监听
    //0000 1000:  8 视频监听  0001 0000：16  报警监听
    public native int  JniAdd51SeeListener(int handle,  I51SeeListener Listener,int ListenerType);
    public native int  JniReleaseSeeListener(int handle,I51SeeListener Listener);
    //请求设备视频 ch 0,1
    public native int  JniSee51SDKRequestVideo(int handle,  int ch);
    //请求视频质量	1:Max   2:Mid  3:Min
    public native int  JniSee51SDKSetVideoQuality(int handle, int q);
    //请求设备音频， ch 1
    public native int  JniSee51SDKRequestAudio(int handle,  int ch);
    //请求设备音视频
    public native int  JniSee51SDKRequestVideoAudio(int handle, int ch);

    //停止视频
    public native int  JniSee51SDKStopDevVideo(int handle);
    //停止音频
    public native int  JniSee51SDKStopDevAuido(int handle);
    //停止音视频
    public native int  JniSee51SDKStopDevAll(int handle);

   //请求设备报警
    public native int JniSee51SDKRequestAlarm(int handle);
    //停止设备报警
    public native int JniSee51SDKStopAlarm(int handle);

    //请求像设备发送音频数据，15s 内不发生数据，将失效
    public native int JniSee51SDKRequestSendAudio(int handle);
    //像设备发送数据
    public native int JniSee51SDKSendAudioData(int handle, byte[] aacdata);

    public native String Jni51SeeLogin(String  acc, String  pass);
    /********获取设备列表 返回json********/
    public native String JniGet51SeeGroupDevs(int GroupId, String  acc, String  access_token);
    /*****获取json的简单字段*****/
    public native String Jni51GetSimpleJsonFiled(String  json, String filed);
    /****获取Ip字段*****/
    public native  String JniParseMediaIPFromUrl(String  sspurl);
}